const seq = require('../connections/mysql_connect'),
      {STRING, INT, TEXT, DECIMAL} = require('../../config/db_type_config');

const Prodcut = seq.define('prodcut', {
  pid: {
    comment: 'product_ID',
    type: INT,
    allowNull: false,
    unique: true
  },
  pImgUrlKey: {
    comment: 'qiniu_product_image_url_key',
    type: STRING,
    allowNull: false
  },
  pBigSort: {
    comment: 'product_big_classfication',
    type: STRING,
    allowNull: false
  },
  pDetailSort: {
    comment: 'product_detail_classfication',
    type: STRING,
    allowNull: false
  },
  pName: {
    comment: 'product_name',
    type: STRING,
    allowNull: false
  },
  pIntro: {
    comment: 'product_introduction',
    type: STRING,
    allowNull: false
  },
  pPrice: {
    comment: 'product_price',
    type: DECIMAL, //小数
    allowNull: false
  },
  pBuyInPrice: {
    comment: 'product_buy_in_price',
    type: DECIMAL, //小数
    allowNull: false
  },
  pPurchased: {
    comment: 'how_many_people_bought_the_product',
    type: INT,
    defaultValue: 0,  //设置初始值
    allowNull: false
  },
  pReserve  : {
    comment: 'has_product_now_?',
    type: STRING,
    allowNull: false
  },
  pTag: {
    comment: 'product_tag_for_showing_someting',
    type: STRING,
    allowNull: false
  },
  status: {
    comment: 'course_status_which_means_that_is_show_product',
    type: INT,
    defaultValue: 1,
    allowNull: false
  },
  isPromote: {
    comment: 'this_mean_the_product_is_in_promote',
    type: INT,
    defaultValue: 0,
    allowNull: false
  }
})

module.exports = Prodcut;